using System;
using System.Web;
using ASPNETVN.PORTAL.Components.Helpers;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Components.Share;

namespace ASPNETVN.PORTAL.Modules.SUPPORT.Controls
{
    public partial class Message : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                Components.Topic topic = Components.Topic.Load(this.ItemID);
                if (topic != null)
                {
                    Category category = Category.Load(topic.CategoryID);
                    txtCategory.Text = category.Title;
                    txtTopicTitle.Text = HttpUtility.HtmlDecode(topic.Title);
                }
            }
        }

        protected void btnReply_Click(object sender, EventArgs e)
        {            
            string url = HttpUrlBuilder.BuildAddEditUrl(this.ModuleID, this.ItemID, "AddEditMessage", "");
            Response.Redirect(url);
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            string url = HttpUrlBuilder.BuildModulePageUrl(this.ModuleID, this.ItemID, ModulePages.Topic);
            Response.Redirect(url);
        }
    }
}